{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "### Pull Marquee Carbon Analytics Data with GS Quant\n",
    "\n",
    "First get your portfolio:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "import warnings\n",
    "\n",
    "from IPython.display import display\n",
    "from gs_quant.markets.portfolio_manager import PortfolioManager\n",
    "from gs_quant.session import GsSession, Environment\n",
    "\n",
    "GsSession.use(Environment.PROD)\n",
    "warnings.filterwarnings(\"ignore\", category=RuntimeWarning)\n",
    "\n",
    "pm = PortfolioManager('MPMFMQP333M81MAR')"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "Then get any of the following Carbon Analytics:"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "print('Data Coverage:')\n",
    "display(pm.get_carbon_coverage(include_estimates=True))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "print('Science Based Target and Net Zero Emissions Target Coverage:')\n",
    "display(pm.get_carbon_sbti_netzero_coverage(include_estimates=True))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "print('Financed Emissions and Intensity Profile:')\n",
    "display(pm.get_carbon_emissions(include_estimates=True))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "print('Financed Emissions by Sector:')\n",
    "display(pm.get_carbon_emissions_allocation(include_estimates=True))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "print('Attribution Analysis:')\n",
    "display(pm.get_carbon_attribution_table(benchmark_id='MA4B66MW5E27U8P32SB', include_estimates=True))"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "It's that simple! Compare with your portfolio's [Marquee](https://marquee.gs.com/s/portfolios/MPMFMQP333M81MAR/carbon?benchmark=MA4B66MW5E27U8P32SB&currency=USD&dateFrom=11-Oct-2020&dateTo=11-Oct-2021&includeEstimates=true&normalizeEmissions=false&reportingYear=Latest&useHistoricalData=false) page"
   ],
   "metadata": {
    "collapsed": false
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}